// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate lazy_static;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// Network configuration for a Data Fusion instance. These configurations
/// are used for peering with the customer network. Configurations are optional
/// when a public Data Fusion instance is to be created. However, providing
/// these configurations allows several benefits, such as reduced network latency
/// while accessing the customer resources from managed Data Fusion instance
/// nodes, as well as access to the customer on-prem resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NetworkConfig {
    /// Name of the network in the customer project with which the Tenant Project
    /// will be peered for executing pipelines. In case of shared VPC where the
    /// network resides in another host project the network should specified in
    /// the form of projects/{host-project-id}/global/networks/{network}
    pub network: std::string::String,

    /// The IP range in CIDR notation to use for the managed Data Fusion instance
    /// nodes. This range must not overlap with any other ranges used in the
    /// customer network.
    pub ip_allocation: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl NetworkConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [network][crate::model::NetworkConfig::network].
    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.network = v.into();
        self
    }

    /// Sets the value of [ip_allocation][crate::model::NetworkConfig::ip_allocation].
    pub fn set_ip_allocation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.ip_allocation = v.into();
        self
    }
}

impl wkt::message::Message for NetworkConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.NetworkConfig"
    }
}

/// The Data Fusion version. This proto message stores information about certain
/// Data Fusion version, which is used for Data Fusion version upgrade.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Version {
    /// The version number of the Data Fusion instance, such as '6.0.1.0'.
    pub version_number: std::string::String,

    /// Whether this is currently the default version for Cloud Data Fusion
    pub default_version: bool,

    /// Represents a list of available feature names for a given version.
    pub available_features: std::vec::Vec<std::string::String>,

    /// Type represents the release availability of the version
    pub r#type: crate::model::version::Type,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Version {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [version_number][crate::model::Version::version_number].
    pub fn set_version_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.version_number = v.into();
        self
    }

    /// Sets the value of [default_version][crate::model::Version::default_version].
    pub fn set_default_version<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.default_version = v.into();
        self
    }

    /// Sets the value of [available_features][crate::model::Version::available_features].
    pub fn set_available_features<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.available_features = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [r#type][crate::model::Version::type].
    pub fn set_type<T: std::convert::Into<crate::model::version::Type>>(mut self, v: T) -> Self {
        self.r#type = v.into();
        self
    }
}

impl wkt::message::Message for Version {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.Version"
    }
}

/// Defines additional types related to [Version].
pub mod version {
    #[allow(unused_imports)]
    use super::*;

    /// Each type represents the release availability of a CDF version
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Type {
        /// Version does not have availability yet
        Unspecified,
        /// Version is under development and not considered stable
        Preview,
        /// Version is available for public use
        GeneralAvailability,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Type::value] or
        /// [Type::name].
        UnknownValue(r#type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod r#type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Type {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Preview => std::option::Option::Some(1),
                Self::GeneralAvailability => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
                Self::Preview => std::option::Option::Some("TYPE_PREVIEW"),
                Self::GeneralAvailability => std::option::Option::Some("TYPE_GENERAL_AVAILABILITY"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Type {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Type {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Type {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Preview,
                2 => Self::GeneralAvailability,
                _ => Self::UnknownValue(r#type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Type {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "TYPE_UNSPECIFIED" => Self::Unspecified,
                "TYPE_PREVIEW" => Self::Preview,
                "TYPE_GENERAL_AVAILABILITY" => Self::GeneralAvailability,
                _ => Self::UnknownValue(r#type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Type {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Preview => serializer.serialize_i32(1),
                Self::GeneralAvailability => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Type {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
                ".google.cloud.datafusion.v1.Version.Type",
            ))
        }
    }
}

/// Identifies Data Fusion accelerators for an instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Accelerator {
    /// The type of an accelator for a CDF instance.
    pub accelerator_type: crate::model::accelerator::AcceleratorType,

    /// The state of the accelerator
    pub state: crate::model::accelerator::State,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Accelerator {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [accelerator_type][crate::model::Accelerator::accelerator_type].
    pub fn set_accelerator_type<
        T: std::convert::Into<crate::model::accelerator::AcceleratorType>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.accelerator_type = v.into();
        self
    }

    /// Sets the value of [state][crate::model::Accelerator::state].
    pub fn set_state<T: std::convert::Into<crate::model::accelerator::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }
}

impl wkt::message::Message for Accelerator {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.Accelerator"
    }
}

/// Defines additional types related to [Accelerator].
pub mod accelerator {
    #[allow(unused_imports)]
    use super::*;

    /// Each type represents an Accelerator (Add-On) supported by Cloud Data Fusion
    /// service.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum AcceleratorType {
        /// Default value, if unspecified.
        Unspecified,
        /// Change Data Capture accelerator for CDF.
        Cdc,
        /// Cloud Healthcare accelerator for CDF. This accelerator is to enable Cloud
        /// Healthcare specific CDF plugins developed by Healthcare team.
        Healthcare,
        /// Contact Center AI Insights
        /// This accelerator is used to enable import and export pipelines
        /// custom built to streamline CCAI Insights processing.
        CcaiInsights,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [AcceleratorType::value] or
        /// [AcceleratorType::name].
        UnknownValue(accelerator_type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod accelerator_type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl AcceleratorType {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Cdc => std::option::Option::Some(1),
                Self::Healthcare => std::option::Option::Some(2),
                Self::CcaiInsights => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("ACCELERATOR_TYPE_UNSPECIFIED"),
                Self::Cdc => std::option::Option::Some("CDC"),
                Self::Healthcare => std::option::Option::Some("HEALTHCARE"),
                Self::CcaiInsights => std::option::Option::Some("CCAI_INSIGHTS"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for AcceleratorType {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for AcceleratorType {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for AcceleratorType {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Cdc,
                2 => Self::Healthcare,
                3 => Self::CcaiInsights,
                _ => Self::UnknownValue(accelerator_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for AcceleratorType {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "ACCELERATOR_TYPE_UNSPECIFIED" => Self::Unspecified,
                "CDC" => Self::Cdc,
                "HEALTHCARE" => Self::Healthcare,
                "CCAI_INSIGHTS" => Self::CcaiInsights,
                _ => Self::UnknownValue(accelerator_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for AcceleratorType {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Cdc => serializer.serialize_i32(1),
                Self::Healthcare => serializer.serialize_i32(2),
                Self::CcaiInsights => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for AcceleratorType {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AcceleratorType>::new(
                ".google.cloud.datafusion.v1.Accelerator.AcceleratorType",
            ))
        }
    }

    /// Different values possible for the state of an accelerator
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Default value, do not use
        Unspecified,
        /// Indicates that the accelerator is enabled and available to use
        Enabled,
        /// Indicates that the accelerator is disabled and not available to use
        Disabled,
        /// Indicates that accelerator state is currently unknown.
        /// Requests for enable, disable could be retried while in this state
        Unknown,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Enabled => std::option::Option::Some(1),
                Self::Disabled => std::option::Option::Some(2),
                Self::Unknown => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Enabled => std::option::Option::Some("ENABLED"),
                Self::Disabled => std::option::Option::Some("DISABLED"),
                Self::Unknown => std::option::Option::Some("UNKNOWN"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Enabled,
                2 => Self::Disabled,
                3 => Self::Unknown,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "ENABLED" => Self::Enabled,
                "DISABLED" => Self::Disabled,
                "UNKNOWN" => Self::Unknown,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Enabled => serializer.serialize_i32(1),
                Self::Disabled => serializer.serialize_i32(2),
                Self::Unknown => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.datafusion.v1.Accelerator.State",
            ))
        }
    }
}

/// The crypto key configuration. This field is used by the Customer-managed
/// encryption keys (CMEK) feature.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CryptoKeyConfig {
    /// The name of the key which is used to encrypt/decrypt customer data. For key
    /// in Cloud KMS, the key should be in the format of
    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
    pub key_reference: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CryptoKeyConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [key_reference][crate::model::CryptoKeyConfig::key_reference].
    pub fn set_key_reference<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.key_reference = v.into();
        self
    }
}

impl wkt::message::Message for CryptoKeyConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.CryptoKeyConfig"
    }
}

/// Represents a Data Fusion instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Instance {
    /// Output only. The name of this instance is in the form of
    /// projects/{project}/locations/{location}/instances/{instance}.
    pub name: std::string::String,

    /// A description of this instance.
    pub description: std::string::String,

    /// Required. Instance type.
    pub r#type: crate::model::instance::Type,

    /// Option to enable Stackdriver Logging.
    pub enable_stackdriver_logging: bool,

    /// Option to enable Stackdriver Monitoring.
    pub enable_stackdriver_monitoring: bool,

    /// Specifies whether the Data Fusion instance should be private. If set to
    /// true, all Data Fusion nodes will have private IP addresses and will not be
    /// able to access the public internet.
    pub private_instance: bool,

    /// Network configuration options. These are required when a private Data
    /// Fusion instance is to be created.
    pub network_config: std::option::Option<crate::model::NetworkConfig>,

    /// The resource labels for instance to use to annotate any related underlying
    /// resources such as Compute Engine VMs. The character '=' is not allowed to
    /// be used within the labels.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Map of additional options used to configure the behavior of
    /// Data Fusion instance.
    pub options: std::collections::HashMap<std::string::String, std::string::String>,

    /// Output only. The time the instance was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the instance was last updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The current state of this Data Fusion instance.
    pub state: crate::model::instance::State,

    /// Output only. Additional information about the current state of this Data
    /// Fusion instance if available.
    pub state_message: std::string::String,

    /// Output only. Endpoint on which the Data Fusion UI is accessible.
    pub service_endpoint: std::string::String,

    /// Name of the zone in which the Data Fusion instance will be created. Only
    /// DEVELOPER instances use this field.
    pub zone: std::string::String,

    /// Current version of the Data Fusion. Only specifiable in Update.
    pub version: std::string::String,

    /// Output only. Deprecated. Use tenant_project_id instead to extract the tenant project ID.
    #[deprecated]
    pub service_account: std::string::String,

    /// Display name for an instance.
    pub display_name: std::string::String,

    /// Available versions that the instance can be upgraded to using
    /// UpdateInstanceRequest.
    pub available_version: std::vec::Vec<crate::model::Version>,

    /// Output only. Endpoint on which the REST APIs is accessible.
    pub api_endpoint: std::string::String,

    /// Output only. Cloud Storage bucket generated by Data Fusion in the customer project.
    pub gcs_bucket: std::string::String,

    /// List of accelerators enabled for this CDF instance.
    pub accelerators: std::vec::Vec<crate::model::Accelerator>,

    /// Output only. P4 service account for the customer project.
    pub p4_service_account: std::string::String,

    /// Output only. The name of the tenant project.
    pub tenant_project_id: std::string::String,

    /// User-managed service account to set on Dataproc when Cloud Data Fusion
    /// creates Dataproc to run data processing pipelines.
    ///
    /// This allows users to have fine-grained access control on Dataproc's
    /// accesses to cloud resources.
    pub dataproc_service_account: std::string::String,

    /// Option to enable granular role-based access control.
    pub enable_rbac: bool,

    /// The crypto key configuration. This field is used by the Customer-Managed
    /// Encryption Keys (CMEK) feature.
    pub crypto_key_config: std::option::Option<crate::model::CryptoKeyConfig>,

    /// Output only. If the instance state is DISABLED, the reason for disabling the instance.
    pub disabled_reason: std::vec::Vec<crate::model::instance::DisabledReason>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Instance {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Instance::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::Instance::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [r#type][crate::model::Instance::type].
    pub fn set_type<T: std::convert::Into<crate::model::instance::Type>>(mut self, v: T) -> Self {
        self.r#type = v.into();
        self
    }

    /// Sets the value of [enable_stackdriver_logging][crate::model::Instance::enable_stackdriver_logging].
    pub fn set_enable_stackdriver_logging<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.enable_stackdriver_logging = v.into();
        self
    }

    /// Sets the value of [enable_stackdriver_monitoring][crate::model::Instance::enable_stackdriver_monitoring].
    pub fn set_enable_stackdriver_monitoring<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.enable_stackdriver_monitoring = v.into();
        self
    }

    /// Sets the value of [private_instance][crate::model::Instance::private_instance].
    pub fn set_private_instance<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.private_instance = v.into();
        self
    }

    /// Sets the value of [network_config][crate::model::Instance::network_config].
    pub fn set_network_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::NetworkConfig>,
    {
        self.network_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [network_config][crate::model::Instance::network_config].
    pub fn set_or_clear_network_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::NetworkConfig>,
    {
        self.network_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::Instance::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [options][crate::model::Instance::options].
    pub fn set_options<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.options = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [create_time][crate::model::Instance::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Instance::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [state][crate::model::Instance::state].
    pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_message][crate::model::Instance::state_message].
    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.state_message = v.into();
        self
    }

    /// Sets the value of [service_endpoint][crate::model::Instance::service_endpoint].
    pub fn set_service_endpoint<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.service_endpoint = v.into();
        self
    }

    /// Sets the value of [zone][crate::model::Instance::zone].
    pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.zone = v.into();
        self
    }

    /// Sets the value of [version][crate::model::Instance::version].
    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.version = v.into();
        self
    }

    /// Sets the value of [service_account][crate::model::Instance::service_account].
    #[deprecated]
    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service_account = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::Instance::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [available_version][crate::model::Instance::available_version].
    pub fn set_available_version<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Version>,
    {
        use std::iter::Iterator;
        self.available_version = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [api_endpoint][crate::model::Instance::api_endpoint].
    pub fn set_api_endpoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_endpoint = v.into();
        self
    }

    /// Sets the value of [gcs_bucket][crate::model::Instance::gcs_bucket].
    pub fn set_gcs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.gcs_bucket = v.into();
        self
    }

    /// Sets the value of [accelerators][crate::model::Instance::accelerators].
    pub fn set_accelerators<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Accelerator>,
    {
        use std::iter::Iterator;
        self.accelerators = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [p4_service_account][crate::model::Instance::p4_service_account].
    pub fn set_p4_service_account<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.p4_service_account = v.into();
        self
    }

    /// Sets the value of [tenant_project_id][crate::model::Instance::tenant_project_id].
    pub fn set_tenant_project_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.tenant_project_id = v.into();
        self
    }

    /// Sets the value of [dataproc_service_account][crate::model::Instance::dataproc_service_account].
    pub fn set_dataproc_service_account<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.dataproc_service_account = v.into();
        self
    }

    /// Sets the value of [enable_rbac][crate::model::Instance::enable_rbac].
    pub fn set_enable_rbac<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.enable_rbac = v.into();
        self
    }

    /// Sets the value of [crypto_key_config][crate::model::Instance::crypto_key_config].
    pub fn set_crypto_key_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CryptoKeyConfig>,
    {
        self.crypto_key_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [crypto_key_config][crate::model::Instance::crypto_key_config].
    pub fn set_or_clear_crypto_key_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CryptoKeyConfig>,
    {
        self.crypto_key_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [disabled_reason][crate::model::Instance::disabled_reason].
    pub fn set_disabled_reason<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::instance::DisabledReason>,
    {
        use std::iter::Iterator;
        self.disabled_reason = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for Instance {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.Instance"
    }
}

/// Defines additional types related to [Instance].
pub mod instance {
    #[allow(unused_imports)]
    use super::*;

    /// Represents the type of Data Fusion instance. Each type is configured with
    /// the default settings for processing and memory.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Type {
        /// No type specified. The instance creation will fail.
        Unspecified,
        /// Basic Data Fusion instance. In Basic type, the user will be able to
        /// create data pipelines using point and click UI. However, there are
        /// certain limitations, such as fewer number of concurrent pipelines, no
        /// support for streaming pipelines, etc.
        Basic,
        /// Enterprise Data Fusion instance. In Enterprise type, the user will have
        /// all features available, such as support for streaming pipelines, higher
        /// number of concurrent pipelines, etc.
        Enterprise,
        /// Developer Data Fusion instance. In Developer type, the user will have all
        /// features available but with restrictive capabilities. This is to help
        /// enterprises design and develop their data ingestion and integration
        /// pipelines at low cost.
        Developer,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Type::value] or
        /// [Type::name].
        UnknownValue(r#type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod r#type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Type {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Basic => std::option::Option::Some(1),
                Self::Enterprise => std::option::Option::Some(2),
                Self::Developer => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
                Self::Basic => std::option::Option::Some("BASIC"),
                Self::Enterprise => std::option::Option::Some("ENTERPRISE"),
                Self::Developer => std::option::Option::Some("DEVELOPER"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Type {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Type {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Type {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Basic,
                2 => Self::Enterprise,
                3 => Self::Developer,
                _ => Self::UnknownValue(r#type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Type {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "TYPE_UNSPECIFIED" => Self::Unspecified,
                "BASIC" => Self::Basic,
                "ENTERPRISE" => Self::Enterprise,
                "DEVELOPER" => Self::Developer,
                _ => Self::UnknownValue(r#type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Type {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Basic => serializer.serialize_i32(1),
                Self::Enterprise => serializer.serialize_i32(2),
                Self::Developer => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Type {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
                ".google.cloud.datafusion.v1.Instance.Type",
            ))
        }
    }

    /// Represents the state of a Data Fusion instance
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Instance does not have a state yet
        Unspecified,
        /// Instance is being created
        Creating,
        /// Instance is active and ready for requests. This corresponds to 'RUNNING'
        /// in datafusion.v1beta1.
        Active,
        /// Instance creation failed
        Failed,
        /// Instance is being deleted
        Deleting,
        /// Instance is being upgraded
        Upgrading,
        /// Instance is being restarted
        Restarting,
        /// Instance is being updated on customer request
        Updating,
        /// Instance is being auto-updated
        AutoUpdating,
        /// Instance is being auto-upgraded
        AutoUpgrading,
        /// Instance is disabled
        Disabled,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Creating => std::option::Option::Some(1),
                Self::Active => std::option::Option::Some(2),
                Self::Failed => std::option::Option::Some(3),
                Self::Deleting => std::option::Option::Some(4),
                Self::Upgrading => std::option::Option::Some(5),
                Self::Restarting => std::option::Option::Some(6),
                Self::Updating => std::option::Option::Some(7),
                Self::AutoUpdating => std::option::Option::Some(8),
                Self::AutoUpgrading => std::option::Option::Some(9),
                Self::Disabled => std::option::Option::Some(10),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Creating => std::option::Option::Some("CREATING"),
                Self::Active => std::option::Option::Some("ACTIVE"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::Upgrading => std::option::Option::Some("UPGRADING"),
                Self::Restarting => std::option::Option::Some("RESTARTING"),
                Self::Updating => std::option::Option::Some("UPDATING"),
                Self::AutoUpdating => std::option::Option::Some("AUTO_UPDATING"),
                Self::AutoUpgrading => std::option::Option::Some("AUTO_UPGRADING"),
                Self::Disabled => std::option::Option::Some("DISABLED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Creating,
                2 => Self::Active,
                3 => Self::Failed,
                4 => Self::Deleting,
                5 => Self::Upgrading,
                6 => Self::Restarting,
                7 => Self::Updating,
                8 => Self::AutoUpdating,
                9 => Self::AutoUpgrading,
                10 => Self::Disabled,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "CREATING" => Self::Creating,
                "ACTIVE" => Self::Active,
                "FAILED" => Self::Failed,
                "DELETING" => Self::Deleting,
                "UPGRADING" => Self::Upgrading,
                "RESTARTING" => Self::Restarting,
                "UPDATING" => Self::Updating,
                "AUTO_UPDATING" => Self::AutoUpdating,
                "AUTO_UPGRADING" => Self::AutoUpgrading,
                "DISABLED" => Self::Disabled,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Creating => serializer.serialize_i32(1),
                Self::Active => serializer.serialize_i32(2),
                Self::Failed => serializer.serialize_i32(3),
                Self::Deleting => serializer.serialize_i32(4),
                Self::Upgrading => serializer.serialize_i32(5),
                Self::Restarting => serializer.serialize_i32(6),
                Self::Updating => serializer.serialize_i32(7),
                Self::AutoUpdating => serializer.serialize_i32(8),
                Self::AutoUpgrading => serializer.serialize_i32(9),
                Self::Disabled => serializer.serialize_i32(10),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.datafusion.v1.Instance.State",
            ))
        }
    }

    /// The reason for disabling the instance if the state is DISABLED.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum DisabledReason {
        /// This is an unknown reason for disabling.
        Unspecified,
        /// The KMS key used by the instance is either revoked or denied access to
        KmsKeyIssue,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [DisabledReason::value] or
        /// [DisabledReason::name].
        UnknownValue(disabled_reason::UnknownValue),
    }

    #[doc(hidden)]
    pub mod disabled_reason {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl DisabledReason {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::KmsKeyIssue => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("DISABLED_REASON_UNSPECIFIED"),
                Self::KmsKeyIssue => std::option::Option::Some("KMS_KEY_ISSUE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for DisabledReason {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for DisabledReason {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for DisabledReason {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::KmsKeyIssue,
                _ => Self::UnknownValue(disabled_reason::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for DisabledReason {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "DISABLED_REASON_UNSPECIFIED" => Self::Unspecified,
                "KMS_KEY_ISSUE" => Self::KmsKeyIssue,
                _ => Self::UnknownValue(disabled_reason::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for DisabledReason {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::KmsKeyIssue => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for DisabledReason {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DisabledReason>::new(
                ".google.cloud.datafusion.v1.Instance.DisabledReason",
            ))
        }
    }
}

/// Request message for listing Data Fusion instances.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListInstancesRequest {
    /// Required. The project and location for which to retrieve instance information
    /// in the format projects/{project}/locations/{location}. If the location is
    /// specified as '-' (wildcard), then all regions available to the project
    /// are queried, and the results are aggregated.
    pub parent: std::string::String,

    /// The maximum number of items to return.
    pub page_size: i32,

    /// The next_page_token value to use if there are additional
    /// results to retrieve for this list request.
    pub page_token: std::string::String,

    /// List filter.
    pub filter: std::string::String,

    /// Sort results. Supported values are "name", "name desc",  or "" (unsorted).
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListInstancesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListInstancesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.ListInstancesRequest"
    }
}

/// Response message for the list instance request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListInstancesResponse {
    /// Represents a list of Data Fusion instances.
    pub instances: std::vec::Vec<crate::model::Instance>,

    /// Token to retrieve the next page of results or empty if there are no more
    /// results in the list.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListInstancesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
    pub fn set_instances<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Instance>,
    {
        use std::iter::Iterator;
        self.instances = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListInstancesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.ListInstancesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListInstancesResponse {
    type PageItem = crate::model::Instance;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.instances
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for the list available versions request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAvailableVersionsRequest {
    /// Required. The project and location for which to retrieve instance information
    /// in the format projects/{project}/locations/{location}.
    pub parent: std::string::String,

    /// The maximum number of items to return.
    pub page_size: i32,

    /// The next_page_token value to use if there are additional
    /// results to retrieve for this list request.
    pub page_token: std::string::String,

    /// Whether or not to return the latest patch of every available minor version.
    /// If true, only the latest patch will be returned. Ex. if allowed versions is
    /// [6.1.1, 6.1.2, 6.2.0] then response will be [6.1.2, 6.2.0]
    pub latest_patch_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListAvailableVersionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListAvailableVersionsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListAvailableVersionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListAvailableVersionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [latest_patch_only][crate::model::ListAvailableVersionsRequest::latest_patch_only].
    pub fn set_latest_patch_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.latest_patch_only = v.into();
        self
    }
}

impl wkt::message::Message for ListAvailableVersionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.ListAvailableVersionsRequest"
    }
}

/// Response message for the list available versions request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAvailableVersionsResponse {
    /// Represents a list of versions that are supported.
    pub available_versions: std::vec::Vec<crate::model::Version>,

    /// Token to retrieve the next page of results or empty if there are no more
    /// results in the list.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListAvailableVersionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [available_versions][crate::model::ListAvailableVersionsResponse::available_versions].
    pub fn set_available_versions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Version>,
    {
        use std::iter::Iterator;
        self.available_versions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListAvailableVersionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListAvailableVersionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.ListAvailableVersionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListAvailableVersionsResponse {
    type PageItem = crate::model::Version;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.available_versions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for getting details about a Data Fusion instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetInstanceRequest {
    /// Required. The instance resource name in the format
    /// projects/{project}/locations/{location}/instances/{instance}.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetInstanceRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.GetInstanceRequest"
    }
}

/// Request message for creating a Data Fusion instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateInstanceRequest {
    /// Required. The instance's project and location in the format
    /// projects/{project}/locations/{location}.
    pub parent: std::string::String,

    /// Required. The name of the instance to create.
    pub instance_id: std::string::String,

    /// An instance resource.
    pub instance: std::option::Option<crate::model::Instance>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.instance_id = v.into();
        self
    }

    /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
    pub fn set_instance<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Instance>,
    {
        self.instance = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Instance>,
    {
        self.instance = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.CreateInstanceRequest"
    }
}

/// Request message for deleting a Data Fusion instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteInstanceRequest {
    /// Required. The instance resource name in the format
    /// projects/{project}/locations/{location}/instances/{instance}
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.DeleteInstanceRequest"
    }
}

/// Request message for updating a Data Fusion instance.
/// Data Fusion allows updating the labels, options, and stack driver settings.
/// This is also used for CDF version upgrade.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateInstanceRequest {
    /// Required. The instance resource that replaces the resource on the server. Currently,
    /// Data Fusion only allows replacing labels, options, and stack driver
    /// settings. All other fields will be ignored.
    pub instance: std::option::Option<crate::model::Instance>,

    /// Field mask is used to specify the fields that the update will overwrite
    /// in an instance resource. The fields specified in the update_mask are
    /// relative to the resource, not the full request.
    /// A field will be overwritten if it is in the mask.
    /// If the user does not provide a mask, all the supported fields (labels,
    /// options, and version currently) will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
    pub fn set_instance<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Instance>,
    {
        self.instance = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Instance>,
    {
        self.instance = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.UpdateInstanceRequest"
    }
}

/// Request message for restarting a Data Fusion instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RestartInstanceRequest {
    /// Required. Name of the Data Fusion instance which need to be restarted in the form of
    /// projects/{project}/locations/{location}/instances/{instance}
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RestartInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::RestartInstanceRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for RestartInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.RestartInstanceRequest"
    }
}

/// Represents the metadata of a long-running operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
    /// The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Human-readable status of the operation if any.
    pub status_detail: std::string::String,

    /// Identifies whether the user has requested cancellation
    /// of the operation. Operations that have successfully been cancelled
    /// have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
    /// corresponding to `Code.CANCELLED`.
    ///
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// API version used to start the operation.
    pub api_version: std::string::String,

    /// Map to hold any additional status info for the operation
    /// If there is an accelerator being enabled/disabled/deleted, this will be
    /// populated with accelerator name as key and status as
    /// ENABLING, DISABLING or DELETING
    pub additional_status: std::collections::HashMap<std::string::String, std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::OperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_detail = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }

    /// Sets the value of [additional_status][crate::model::OperationMetadata::additional_status].
    pub fn set_additional_status<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.additional_status = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for OperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.datafusion.v1.OperationMetadata"
    }
}
